<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/12/1
 * Time: 9:14
 */

namespace app\admin\controller;

//会员充值记录
use app\Model\RechargeModel;

class Recharge extends Common
{
    /*
     * 会员充值记录页面
     */
    public function index()
    {
        $postData = input('get.');

        $where = [];
        $time=[0,time()];

        if (isset($postData['nickname'])){
            if ($postData['nickname']){
                $where['nickname'] = ['LIKE', '%'.$postData['nickname'].'%'];
            }
            if ($postData['ctime']){
                $postData['ctime']=explode(" - ", $postData['ctime']);//时间分割成[0]第一个 [1]第二个 取中间值
                $time[0]=strtotime($postData['ctime'][0]);
                $time[1]=strtotime($postData['ctime'][1])+86399;
            }
        }
        $getRecharge= RechargeModel::
            order('order_id','desc')
            ->where($where)//筛选
            ->whereTime('ctime', 'between', [$time[0], $time[1]])//筛选时间
            ->paginate(null,false,['query'=>request()->param()]);
        $data['data'] = $getRecharge;
        $this->getConAndAct('member');
        return view('index',$data);
    }

}